package com.wangxinrou.wangxinrou_surprisemeal.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wangxinrou.wangxinrou_surprisemeal.model.Restaurant;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RestaurantMapper extends BaseMapper<Restaurant> {
    // 批量添加餐馆
    @Insert({
            "<script>",
            "INSERT INTO restaurant (name, address, rating) VALUES",
            "<foreach collection='restaurants' item='restaurant' separator=','>",
            "(#{restaurant.name}, #{restaurant.address}, #{restaurant.rating})",
            "</foreach>",
            "</script>"
    })
    int insertBatchSomeColumn(@Param("restaurants") List<Restaurant> restaurants);
}